package CalculatorTest;

public class Calculator
{

    public double calc(String action, double arg1, double arg2) {
        if (action.equals("+")) {
            return arg1 + arg2;
        }
        else if (action.equals("-")) {
            return arg1 - arg2;
        }
        else if (action.equals("*")) {
            return arg1 * arg2;
        }
        else if (action.equals("/")) {
            return arg1 / arg2;
        }

        else {
            throw new IllegalArgumentException("Error");
        }

    }
}
